package [basepackage].constant;

import net.wicp.tams.common.exception.ExceptAll;
import net.wicp.tams.common.exception.IExcept;

/***
 * 系统定义的的殊错误类型
 * 
 * 公共的错误类型见: ExceptAll
 * 
 * @author zhoujunhui
 *
 */
public enum ErrorTams implements IExcept {
	// 系统通用型错误(包括Java相关错误) 在 1000-9999
	pwderror("错误的分享码", 10000),

	shareTimeOut("分享链接超时", 10001);

	public static IExcept getByName(String name) {
		for (ErrorTams errorHammer : ErrorTams.values()) {
			if (errorHammer.name().equalsIgnoreCase(name)) {
				return errorHammer;
			}
		}
		return ExceptAll.project_other;
	}

	private final String desc;
	private final int value;
	private final int http;

	private ErrorTams(String desc, int value, int http) {
		this.desc = desc;
		this.value = value;
		this.http = http;
	}

	private ErrorTams(String desc, int value) {
		this.desc = desc;
		this.value = value;
		this.http = 500;
	}

	@Override
	public String getDesc() {
		return this.desc;
	}

	@Override
	public int getErrorValue() {
		return this.value;
	}

	@Override
	public String getErrorCode() {
		return this.name();
	}

	@Override
	public String getErrMsg() {
		return this.desc;
	}

	@Override
	public String getErrMsg(Object errBean) {
		return this.desc;
	}

	@Override
	public String getHttp() {
		return Integer.toString(http);
	}
}
